import {theme} from "../../common/theme.js";

export const css = `
  :root {
    --icon-primary-color: ${theme.iconColor};
    --action-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --action-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --action-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --primary-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
    --primary-gradient-hover: linear-gradient(135deg, #2563eb, #1d4ed8);
  }

  .user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }

  .login-section {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .action-buttons-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  /* Shoelace 按钮基础样式重置 */
  sl-button {
    --sl-button-height-medium: 44px;
    --sl-button-border-radius-medium: 12px;
  }

  /* 方形动作按钮样式 */
  .action-btn {
    --sl-button-height-medium: 44px;
    --sl-button-border-radius-medium: 12px;
  }

  .action-btn::part(base) {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    transition: var(--action-transition);
    backdrop-filter: blur(12px);
    box-shadow: var(--action-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .action-btn::part(base):hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--action-shadow-hover);
  }

  .action-btn sl-icon {
    font-size: 20px;
    color: var(--icon-primary-color);
    transition: var(--action-transition);
  }

  .action-btn:hover sl-icon {
    color: var(--icon-primary-color);
    transform: scale(1.1);
  }

  /* 登录按钮样式 */
  .login-btn {
    --sl-button-height-medium: 32px;
    --sl-button-border-radius-medium: 22px;
  }

  .login-btn::part(base) {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ef4444;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    box-shadow: var(--action-shadow);
    padding: 2px 20px;
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
    box-sizing: border-box;
  }

  .login-btn::part(base):hover {
    color: #ef4444;
    border-color: #ef4444;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.2);
  }

  .login-btn::part(base):active {
    transform: translateY(0) scale(1.02);
    box-shadow: var(--action-shadow);
  }

  .login-btn sl-icon {
    font-size: 16px;
    color: #ef4444;
    transition: var(--action-transition);
  }

  .login-btn:hover sl-icon {
    color: #ef4444;
    transform: scale(1.05);
  }

  /* 注册按钮样式 */
  .register-btn {
    --sl-button-height-medium: 44px;
    --sl-button-border-radius-medium: 28px;
  }

  .register-btn::part(base) {
    background: var(--primary-gradient);
    border: none;
    color: white;
    transition: var(--action-transition);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
    box-sizing: border-box;
  }

  .register-btn::part(base):hover {
    background: var(--primary-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
  }

  .register-btn::part(base):active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  }

  .register-btn sl-icon {
    font-size: 16px;
    color: white;
    transition: var(--action-transition);
  }

  .register-btn:hover sl-icon {
    transform: scale(1.1);
  }

  /* 平板设备 */
  @media (max-width: 1024px) {
    .user-actions {
      gap: 10px;
      right: 15px;
    }

    .login-section {
      gap: 10px;
    }

    .action-buttons-container {
      gap: 10px;
    }

    .action-btn {
      --sl-button-height-medium: 40px;
      --sl-button-border-radius-medium: 10px;
    }

    .action-btn::part(base) {
      width: 40px;
      height: 40px;
    }

    .action-btn sl-icon {
      font-size: 18px;
    }

    .login-btn {
      --sl-button-height-medium: 40px;
      --sl-button-border-radius-medium: 20px;
    }

    .register-btn {
      --sl-button-height-medium: 40px;
      --sl-button-border-radius-medium: 24px;
    }

    .login-btn::part(base) {
      padding: 8px 16px;
      font-size: 13px;
      min-height: 40px;
    }

    .register-btn::part(base) {
      padding: 10px 20px;
      font-size: 13px;
      min-height: 40px;
    }

    .login-btn sl-icon,
    .register-btn sl-icon {
      font-size: 14px;
    }
  }

  /* 移动设备 - 横屏 */
  @media (max-width: 768px) {
    .user-actions {
      gap: 8px;
      right: 12px;
    }

    .login-section {
      gap: 8px;
    }

    .action-buttons-container {
      gap: 8px;
    }

    .action-btn {
      --sl-button-height-medium: 36px;
      --sl-button-border-radius-medium: 8px;
    }

    .action-btn::part(base) {
      width: 36px;
      height: 36px;
    }

    .action-btn sl-icon {
      font-size: 16px;
    }

    .login-btn {
      --sl-button-height-medium: 36px;
      --sl-button-border-radius-medium: 18px;
    }

    .register-btn {
      --sl-button-height-medium: 36px;
      --sl-button-border-radius-medium: 20px;
    }

    .login-btn::part(base) {
      padding: 6px 14px;
      font-size: 12px;
      min-height: 36px;
    }

    .register-btn::part(base) {
      padding: 8px 16px;
      font-size: 12px;
      min-height: 36px;
    }

    .login-btn sl-icon,
    .register-btn sl-icon {
      font-size: 13px;
    }
  }

  /* 移动设备 - 竖屏 */
  @media (max-width: 480px) {
    .user-actions {
      gap: 6px;
      right: 10px;
    }

    .login-section {
      gap: 6px;
    }

    .action-buttons-container {
      gap: 6px;
    }

    .action-btn {
      --sl-button-height-medium: 32px;
      --sl-button-border-radius-medium: 6px;
    }

    .action-btn::part(base) {
      width: 32px;
      height: 32px;
    }

    .action-btn sl-icon {
      font-size: 14px;
    }

    .login-btn {
      --sl-button-height-medium: 32px;
      --sl-button-border-radius-medium: 16px;
    }

    .register-btn {
      --sl-button-height-medium: 32px;
      --sl-button-border-radius-medium: 16px;
    }

    .login-btn::part(base) {
      padding: 5px 10px;
      font-size: 11px;
      min-height: 32px;
    }

    .register-btn::part(base) {
      padding: 6px 12px;
      font-size: 11px;
      min-height: 32px;
    }

    .login-btn sl-icon,
    .register-btn sl-icon {
      font-size: 12px;
    }
  }

  /* 小屏幕设备 */
  @media (max-width: 320px) {
    .user-actions {
      gap: 4px;
      right: 8px;
    }

    .login-section {
      gap: 4px;
    }

    .action-buttons-container {
      gap: 4px;
    }

    .action-btn {
      --sl-button-height-medium: 28px;
      --sl-button-border-radius-medium: 4px;
    }

    .action-btn::part(base) {
      width: 28px;
      height: 28px;
    }

    .action-btn sl-icon {
      font-size: 12px;
    }

    .login-btn {
      --sl-button-height-medium: 28px;
      --sl-button-border-radius-medium: 14px;
    }

    .register-btn {
      --sl-button-height-medium: 28px;
      --sl-button-border-radius-medium: 14px;
    }

    .login-btn::part(base) {
      padding: 4px 8px;
      font-size: 10px;
      min-height: 28px;
    }

    .register-btn::part(base) {
      padding: 4px 8px;
      font-size: 10px;
      min-height: 28px;
    }

    .login-btn sl-icon,
    .register-btn sl-icon {
      font-size: 10px;
    }
  }

  /* 工具提示样式 */
  sl-tooltip::part(body) {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  sl-tooltip::part(arrow) {
    color: rgba(0, 0, 0, 0.9);
  }

  /* 登录按钮文字样式 */
  .login-btn span {
    color: #ef4444;
    transition: var(--action-transition);
  }

  /* 确保图标和文字的间距 */
  .login-btn sl-icon[slot="prefix"] {
    margin-right: 8px;
  }

  .register-btn sl-icon[slot="prefix"] {
    margin-right: 8px;
  }
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  sl-tooltip::part(arrow) {
    color: rgba(0, 0, 0, 0.9);
  }

  /* 响应式设计 - 平板设备 */
  @media (max-width: 1024px) {
    :host {
      --button-height: 44px;
      --circle-button-size: 44px;
      --button-min-width: 75px;
      --button-gap: 10px;
    }

    .login-btn,
    .register-btn {
      --sl-button-height-medium: var(--button-height);
      --sl-spacing-medium: 10px 16px;
    }

    .login-btn sl-icon {
      font-size: 14px;
      margin-right: 6px;
    }
  }

  /* 响应式设计 - 移动设备 */
  @media (max-width: 768px) {
    :host {
      --button-height: 42px;
      --circle-button-size: 42px;
      --button-min-width: 70px;
      --button-gap: 8px;
    }

    .login-btn,
    .register-btn {
      --sl-button-height-medium: var(--button-height);
      --sl-spacing-medium: 8px 14px;
      font-size: 14px;
    }

    .login-btn sl-icon {
      font-size: 12px;
      margin-right: 4px;
    }

    sl-tooltip::part(body) {
      font-size: 13px;
      padding: 6px 10px;
    }
  }

  /* 响应式设计 - 小屏移动设备 */
  @media (max-width: 480px) {
    :host {
      --button-gap: 6px;
    }

    .user-actions {
      gap: var(--button-gap);
    }

    /* 小屏幕设备上隐藏注册按钮文字，只显示图标 */
    .register-btn .button-text {
      display: none;
    }

    .register-btn {
      min-width: var(--button-height);
      padding: 0 12px;
    }

    .register-btn sl-icon {
      font-size: 12px;
    }
  }

  /* 暗色主题适配 */
  @media (prefers-color-scheme: dark) {
    :host {
      --primary-color: #60a5fa;
      --primary-hover: #3b82f6;
      --primary-active: #2563eb;
    }

    sl-tooltip::part(body) {
      background: rgba(30, 41, 59, 0.95);
      border: 1px solid rgba(255, 255, 255, 0.2);
    }

    sl-tooltip::part(arrow) {
      color: rgba(30, 41, 59, 0.95);
    }
  }

  /* 高对比度模式支持 */
  @media (prefers-contrast: high) {
    .login-btn::part(base) {
      border-width: 3px;
    }

    .register-btn::part(base) {
      border-width: 3px;
    }

    sl-tooltip::part(body) {
      border-width: 2px;
    }
  }

  /* 减少动画模式支持 */
  @media (prefers-reduced-motion: reduce) {
    :host {
      --transition-duration: 0.1s;
    }

    .login-btn::part(base):hover,
    .register-btn::part(base):hover {
      transform: none;
    }

    .login-btn::part(base):active,
    .register-btn::part(base):active {
      transform: none;
    }
  }

  /* 焦点样式 - 无障碍支持 */
  .login-btn::part(base):focus-visible,
  .register-btn::part(base):focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* 加载状态样式 */
  .login-btn[loading]::part(base),
  .register-btn[loading]::part(base) {
    cursor: not-allowed;
    opacity: 0.7;
  }

  /* 禁用状态样式 */
  .login-btn[disabled]::part(base),
  .register-btn[disabled]::part(base) {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
  }
`;